package com.ruoyi.system.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.InventoryTransactionDetailsMapper;
import com.ruoyi.system.domain.InventoryTransactionDetails;
import com.ruoyi.system.service.IInventoryTransactionDetailsService;

/**
 * 出入库明细 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-30
 */
@Service
public class InventoryTransactionDetailsServiceImpl implements IInventoryTransactionDetailsService
{
    @Autowired
    private InventoryTransactionDetailsMapper inventoryTransactionDetailsMapper;

    /**
     * 通过id查询出入库明细
     *
     * @param id 出入库明细主键
     * @return 出入库明细
     */
    @Override
    public InventoryTransactionDetails selectInventoryTransactionDetailsById(Long id)
    {
        return inventoryTransactionDetailsMapper.selectInventoryTransactionDetailsById(id);
    }

    /**
     * 通过仓库名称,出入库类型，出入库单号，开始时间，结束时间和商品名称查询出入库明细列表
     *
     * @param warehouseName,transactionType,transactionNumber,startTime,endTime,productName 仓库名称,出入库类型，出入库单号，开始时间，结束时间,商品名称
     * @return 出入库明细
     */
    @Override
    public List<InventoryTransactionDetails> selectInventoryTransactionDetailsListByConditions(String warehouseName, String transactionType, String transactionNumber, Date startTime, Date endTime,String productName)
    {
        return inventoryTransactionDetailsMapper.selectInventoryTransactionDetailsListByConditions(warehouseName,transactionType,transactionNumber,startTime,endTime,productName);
    }

    /**
     * 新增出入库明细
     *
     * @param inventoryTransactionDetails 出入库明细
     * @return 结果
     */
    @Override
    public int insertInventoryTransactionDetails(InventoryTransactionDetails inventoryTransactionDetails)
    {
        return inventoryTransactionDetailsMapper.insertInventoryTransactionDetails(inventoryTransactionDetails);
    }

    /**
     * 修改出入库明细
     *
     * @param inventoryTransactionDetails 出入库明细
     * @return 结果
     */
    @Override
    public int updateInventoryTransactionDetails(InventoryTransactionDetails inventoryTransactionDetails)
    {
        return inventoryTransactionDetailsMapper.updateInventoryTransactionDetails(inventoryTransactionDetails);
    }

    /**
     * 通过id批量删除出入库明细信息
     *
     * @param ids 需要删除的出入库明细主键
     * @return 结果
     */
    @Override
    public int deleteInventoryTransactionDetailsByIds(Long[] ids)
    {
        return inventoryTransactionDetailsMapper.deleteInventoryTransactionDetailsByIds(ids);
    }

    /**
     * 通过id删除出入库明细信息
     *
     * @param id 出入库明细主键
     * @return 结果
     */
    @Override
    public int deleteInventoryTransactionDetailsById(Long id)
    {
        return inventoryTransactionDetailsMapper.deleteInventoryTransactionDetailsById(id);
    }
}
